<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$lang_fullscreen_title}</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="javascript" type="text/javascript" src="../../tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
	function patchCallback(settings, key) {
		if (settings[key])
			settings[key] = "window.opener." + settings[key];
	}

	var settings = new Array();

	// Clone array
	for (var name in window.opener.tinyMCE.settings)
		settings[name] = window.opener.tinyMCE.settings[name];

	// Override options for fullscreen
	for (var name in window.opener.tinyMCE.settings.fullscreen_settings)
		settings[name] = window.opener.tinyMCE.settings.fullscreen_settings[name];

	// Patch callbacks, make them point to window.opener
	patchCallback(settings, 'urlconverter_callback');
	patchCallback(settings, 'insertlink_callback');
	patchCallback(settings, 'insertimage_callback');
	patchCallback(settings, 'setupcontent_callback');
	patchCallback(settings, 'save_callback');
	patchCallback(settings, 'onchange_callback');
	patchCallback(settings, 'init_instance_callback');
	patchCallback(settings, 'file_browser_callback');
	patchCallback(settings, 'cleanup_callback');
	patchCallback(settings, 'oninit');

	// Set options
	settings['mode'] = 'exact';
	settings['elements'] = 'fullscreenarea';
	settings['ask'] = false;
	settings['setupcontent_callback'] = 'setupContent';
	settings['fullscreen_is_enabled'] = true;
	settings['fullscreen_editor_id'] = window.opener.tinyMCE.getWindowArg("editor_id");
	settings['theme_advanced_resizing'] = false;
	//settings['theme_advanced_text_colors'] = "FF00FF,FFFF00,000000";

	// Init
	tinyMCE.init(settings);
	tinyMCE.documentBasePath = window.opener.tinyMCE.documentBasePath;

	function setupContent(editor_id, body, doc) {
		var inst = tinyMCE.getInstanceById(editor_id);
		var backInst = window.opener.tinyMCE.getInstanceById(tinyMCE.getParam('fullscreen_editor_id'));

		// Setup title
		var divElm = document.createElement("div");
		divElm.innerHTML = tinyMCELang['lang_fullscreen_title'];
		document.title = divElm.innerHTML;

		// Get content
		inst.getBody().innerHTML = backInst.getBody().innerHTML;
	}

	function unloadHandler(e) {
		window.opener.tinyMCE.execInstanceCommand(tinyMCE.getParam('fullscreen_editor_id'), 'mceSetContent', false, tinyMCE.getContent("mce_editor_0"));
	}

	// Add onunload
	tinyMCE.addEvent(window, "beforeunload", unloadHandler);
</script>
</head>
<body style="margin: 0px; overflow: hidden; height: 100%" scrolling="no" scroll="no">

<textarea id="fullscreenarea" style="width: 100%; height: 100%"></textarea>

</body>
</html>
